package com.aidex.biz.service.impl;

import java.util.List;
import com.aidex.common.annotation.DataScope;
import com.github.pagehelper.PageInfo;
import com.aidex.common.core.domain.entity.SysUser;
import com.aidex.common.core.domain.entity.SysDept;
import com.aidex.common.core.service.BaseServiceImpl;
import com.aidex.framework.cache.DeptUtils;
import com.aidex.framework.cache.UserUtils;
import org.springframework.stereotype.Service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.aidex.biz.mapper.OrderDetailsMapper;
import com.aidex.biz.domain.OrderDetails;
import com.aidex.biz.service.OrderDetailsService;
import org.springframework.transaction.annotation.Transactional;
import com.aidex.common.utils.NumberUtils;

/**
 * 订单详情Service业务层处理
 * @author sean
 * @email 2074844820@qq.com
 * @date 2023-07-04
 */
@Service
@Transactional(readOnly = true)
public class OrderDetailsServiceImpl extends BaseServiceImpl<OrderDetailsMapper, OrderDetails> implements OrderDetailsService
{
    private static final Logger log = LoggerFactory.getLogger(OrderDetailsServiceImpl.class);

    /**
     * 获取单条数据
     * @param orderDetails 订单详情
     * @return 订单详情
     */
    @Override
    public OrderDetails get(OrderDetails orderDetails)
    {
        OrderDetails dto = super.get(orderDetails);
        return dto;
    }

    /**
     * 获取单条数据
     * @param id 订单详情id
     * @return 订单详情
     */
    @Override
    public OrderDetails get(String id)
    {
        OrderDetails dto = super.get(id);
        return dto;
    }


    /**
     * 查询订单详情列表
     * @param orderDetails 订单详情
     * @return 订单详情
     */
    @Override
    @DataScope(userAlias = "a",deptAlias = "a")
    public List<OrderDetails> findList(OrderDetails orderDetails)
    {
        return super.findList(orderDetails);
    }

    /**
     * 分页查询订单详情列表
     * @param orderDetails 订单详情
     * @return 订单详情
     */
    @Override
    @DataScope(userAlias = "a",deptAlias = "a")
    public PageInfo<OrderDetails> findPage(OrderDetails orderDetails)
    {
        return super.findPage(orderDetails);
    }

    /**
     * 保存订单详情
     * @param orderDetails
     * @return 结果
     */
    @Override
    public boolean save(OrderDetails orderDetails)
    {
        return super.save(orderDetails);
    }


    /**
     * 删除订单详情信息
     * @param orderDetails
     * @return 结果
     */
    @Override
    public boolean remove(OrderDetails orderDetails)
    {
        return super.remove(orderDetails);
    }

    /**
     * 批量删除订单详情
     * @param ids 需要删除的订单详情ID
     * @return 结果
     */
    @Transactional(readOnly = false)
    @Override
    public int deleteOrderDetailsByIds(String[] ids)
    {
        return mapper.deleteOrderDetailsByIds(ids);
    }

    /**
     * 获取最大编号
     * @param orderDetails 订单详情
     * @return 结果
     */
    @Override
    public int findMaxSort(OrderDetails orderDetails)
    {
        return NumberUtils.nextOrder(mapper.findMaxSort(orderDetails));
    }
}
